layui.carousel.render({
    elem: '#index_banner'
    ,width: '1000px' //设置容器宽度
    ,height: '375px'
    //,arrow: 'always' //始终显示箭头
    //,anim: 'updown' //切换动画方式
});


$(document).scroll(function() {
    if ($(this).scrollTop() <1) {
        $(".header").addClass('theme');
    } else {
        $(".header").removeClass('theme')
    }
});


$(".js-next-navbar").click(function(event) {
    var wra_w = parseInt($('.js-top-list').width());
    var win_w = parseInt($(window).width());
    var yidopx = (wra_w-win_w)/(((wra_w-win_w)/600).toFixed(0));

    var leftpx = parseInt($(".js-wrapper").css('margin-left'));


    var marginLeft = leftpx-yidopx;
    if(-(wra_w-win_w) >= marginLeft){
        marginLeft = -(wra_w-win_w);
        $(".js-next-navbar").hide();
    }
    $(".js-prev-navbar").show();
    window.console.log(wra_w+"--"+win_w+"--"+yidopx+"--"+marginLeft);
    $(".js-wrapper").animate({ marginLeft: marginLeft }, 500);

});

$(".js-prev-navbar").click(function(event) {
    var wra_w = parseInt($('.js-top-list').width());
    var win_w = parseInt($(window).width());
    var yidopx = (wra_w-win_w)/(((wra_w-win_w)/600).toFixed(0));
    var leftpx = parseInt($(".js-wrapper").css('margin-left'));


    var marginLeft = leftpx+yidopx;
    if(0 <= marginLeft){
        marginLeft = 0;
        $(".js-prev-navbar").hide();
    }
    $(".js-next-navbar").show();

    window.console.log(wra_w+"--"+win_w+"--"+yidopx+"--"+marginLeft);
    $(".js-wrapper").animate({ marginLeft: marginLeft }, 500);

});
